package com.ruoyi.system.utils;

import lombok.Getter;
import lombok.Setter;

import java.util.Map;

@Getter
@Setter
public class R {

    private int errCode;
    private String errMsg;
    private boolean success;
    private Map<String,Object> data;
    public R(){}
    public R(int errCode, String errMsg, boolean success){
        this.errCode=errCode;
        this.errMsg=errMsg;
        this.success=success;
    }


    public void R(int errCode, String errMsg, boolean success, Map data) {
        this.errCode = errCode;
        this.errMsg = errMsg;
        this.success = success;
        this.data = data;
    }

    public R set(String errMsg) {
        this.R(-1, errMsg, false, null);
        return this;
    }

    public R set(int errCode, String errMsg) {
        this.R(errCode, errMsg, false, null);
        return this;
    }

    public R set(int errCode, String errMsg, boolean success) {
        this.R(errCode, errMsg, success, null);
        return this;
    }

    public R set(int errCode, String errMsg, boolean success, Map data) {
        this.R(errCode, errMsg, success, data);
        return this;
    }

}